package com.itheima.service.impl;

import com.itheima.dao.DeptMapper;
import com.itheima.pojo.Dept;
import com.itheima.service.TestDeptServiceOne;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDateTime;

@Service
public class TestDeptService implements TestDeptServiceOne {
    @Resource
    DeptMapper deptMapper;

    @Resource
    TestDeptServiceTwo two;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int insertDept() {
        Dept dept = new Dept();
        dept.setName("测试插入One");
        deptMapper.insert(dept);
        two.insertDeptTwo();
        return 0;
    }
}
